<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
	</head>
	<body>
		<script id="test1" type="text/html">
			<h1><% title %></h1>
		</script>
		<script id="test2" type="text/css">
			body{background-color:#0CC;}
		</script>
		<script>
			alert(document.getElementById('test1').innerHTML + '->' + document.getElementById('test2').innerHTML);
		</script>
		<script id="test3" type="text/html">
			<p><a href="#">[UserName]：</a><span class="time">[CreateDate]</span></p>
		</script>
		<div id="comment_ul_2"></div>
		<input type="button" value="click me" onclick="add()" />
		<script type="text/javascript">
			var reg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm');
			function add() {
				var html = document.getElementById("test3").innerHTML;
				var source = html.replace(reg, function(node, key) {
					return {'UserName': 'yang', 'CreateDate': '2014-10-21'}[key];
				});
				document.getElementById('comment_ul_2').innerHTML = source;
			};
		</script>
	</body>
</html>